home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / indexing / IXRecordManager.h < prev    next >
Text File  |  1994-04-13  |  5KB  |  147 lines

  1. /*
  2. IXRecordManager.h
  3. Copyright 1991, NeXT Computer, Inc.
  4. */
  5.  
  6. #import    <btree/IXPostingCursor.h>
  7. #import    <mach/cthreads.h>
  8.  
  9. #import    "IXAttributeParser.h"
  10. #import    "IXPostingList.h"
  11.  
  12. @class IXStore, IXAttribute, IXBTreeCursor;
  13.  
  14. extern IXAttributeParser *IXDefaultAttributeParser();
  15.  
  16. // The count method returns the number of user supplied objects, plus the 
  17. // number of attributes.  To find the number of user supplied objects, subtract 
  18. // the number of attributes, returned by attributeCount, from the count.
  19.  
  20. // Note that when the class of an object activated by a record manager doesn't
  21. // exist in the executable image, new class and meta class objects are created
  22. // and added to the run time.  The method list is empty, restricting instances
  23. // to behavior inherited from existing superclasses.  If another version of the
  24. // class is found in the executable image, however, then the method list of the
  25. // loaded version will be copied to the new class.
  26.  
  27. @interface IXRecordManager: Object 
  28. <IXNameAndFileAccess, IXRecordWriting, IXTransientAccess, IXTransientMessaging, IXAttributeBinding>
  29. {
  30.     struct mutex        _mutexLock;
  31.     id                _storeDirectory;
  32.     id                _dataRepository;
  33.     BOOL            _freeStore;
  34.     unsigned            _handle;
  35.     char            *_handleName;
  36.     IXStore            *_store;
  37.     struct _NXMapTable        *_attributeNames;
  38.     struct _NXMapTable        *_attributeLists;
  39.     struct _NXMapTable        *_privateCursors;
  40.     IXBTreeCursor        *_attributeBTree;
  41.     IXBTreeCursor        *_attributeTable;
  42.     id                _delegate;
  43. }
  44.  
  45. // Returns the store, e.g., [[client store] startTransaction].
  46. - (IXStore *)store;
  47.  
  48. // These methods manage named attributes based on selectors.
  49.  
  50. - removeAttributeNamed:(const char *)name;
  51. - addAttributeNamed:(const char *)name forSelector:(SEL)selector;
  52. - (BOOL)hasAttributeNamed:(const char *)name;
  53.  
  54. - (unsigned)attributeCount; // returns the number of attributes.
  55.  
  56. - (char *)attributeNames;
  57. - (IXPostingCursor *)cursorForAttributeNamed:(const char *)name;
  58. - (SEL)selectorForAttributeNamed:(const char *)name;
  59.  
  60. - (char *)classNames;
  61. - (char *)attributeNamesForClass:aClass;
  62.  
  63. - clean; // removes all discarded records.
  64. - discardRecord:(unsigned)record; // marks a record for later removal.
  65. - reclaimRecord:(unsigned)record; // reclaims a discarded record.
  66.  
  67. - (unsigned)capacity; // returns the highest record number in use.
  68. - (IXPostingList *)contents; // returns all records in the receiver.
  69.  
  70. - (IXPostingList *)discards; // returns the discarded records.
  71. - (IXPostingList *)removals; // returns the handles of all removed records.
  72.  
  73. - (IXPostingList *)recordsForClass:aClass; // does not include subclasses.
  74.  
  75. // These methods manage the subset of the class hierarchy to which a given 
  76. // attribute applies.  They are version sensitive.
  77.  
  78. - setTargetClass:aClass forAttributeNamed:(const char *)name;
  79. - getTargetName:(const char **)target andVersion:(unsigned *)version 
  80.     forAttributeNamed:(const char *)name;
  81.  
  82. // These methods manage an optional user supplied attribute description.
  83.  
  84. - getDescription:(char **)aDescription forAttributeNamed:(const char *)name;
  85. - setDescription:(const char *)aDescription 
  86.     forAttributeNamed:(const char *)name;
  87.  
  88. // Setting a comparison format provides for access to the standard BTree 
  89. // comparators.  The comparison format is remembered across frees.
  90.  
  91. - (const char *)comparisonFormatForAttributeNamed:(const char *)name;
  92. - setComparisonFormat:(const char *)aFormat 
  93.     forAttributeNamed:(const char *)name;
  94.  
  95. // This defaults to string comparison.  Otherwise, it must be set every time
  96. // the record manager is initialized from the store.
  97.  
  98. - getComparator:(IXComparator **)comparator andContext:(const void **)context 
  99.     forAttributeNamed:(const char *)name;
  100. - setComparator:(IXComparator *)comparator andContext:(const void *)context 
  101.     forAttributeNamed:(const char *)name;
  102.  
  103. // Setting a parser on an attribute causes it to be potentially multi- valued.  
  104. // The attribute's value is parsed into one or more sub- values for inversion.
  105.  
  106. - (IXAttributeParser *)parserForAttributeNamed:(const char *)name;
  107. - setParser:(IXAttributeParser *)aParser 
  108.     forAttributeNamed:(const char *)name;
  109.  
  110. // The delegate is passed as the source for the IXRecordTranscription protocol
  111. - setDelegate:anObject;
  112. - delegate;
  113.  
  114. // These methods are used to get and set the value of named properties 
  115. // consisting of arbitrary binary data.  Setting a length of zero removes the 
  116. // named property from the record altogether.
  117.  
  118. - (BOOL)getValue:(void **)value andLength:(unsigned *)length 
  119.     ofBlob:(const char *)name forRecord:(unsigned)record;
  120. - (BOOL)setValue:(const void *)value andLength:(unsigned)length 
  121.     ofBlob:(const char *)name forRecord:(unsigned)record;
  122.  
  123. // These methods are used to establish and access attributes other than the 
  124. // method attributes managed by name by the preceding methods.
  125.  
  126. - addAttribute:(IXAttribute *)anAttribute;
  127. - (const IXAttribute *)attributeNamed:(const char *)name;
  128. - removeAttribute:(IXAttribute *)anAttribute;
  129.  
  130. @end
  131.  
  132. // Any or all of the following methods are optional.
  133.  
  134. @interface Object(IXRecordManagerDelegate)
  135.  
  136. // Called after an object was read from the data repository.
  137. - source:aSource didRead:anObject forRecord:(unsigned)record;
  138.  
  139. // Called after an object was added to the data repository.
  140. - source:aSource didAdd:anObject forRecord:(unsigned)record;
  141.  
  142. // Called after an object was removed from the data repository.
  143. - source:aSource didRemove:anObject forRecord:(unsigned)record;
  144.  
  145. @end
  146.  
  147.